; (completion-preview-complete): Fix bug#76606
authorEshel Yaron <me@eshelyaron.com>
Thu, 27 Feb 2025 14:34:24 +0000 (15:34 +0100)
committerEshel Yaron <me@eshelyaron.com>
Thu, 27 Feb 2025 14:34:24 +0000 (15:34 +0100)
* lisp/completion-preview.el (completion-preview-complete):
Dismiss completion preview before calling ':exit-function'.
This eliminates potential flicker with slow exit functions
and avoids the broken preview update reported in bug#76606.

lisp/completion-preview.el

index 4928d9a8824dfc4b034d7c30e3de9d48eebb077f..505cf45f48d030081a8047537e93ce0c6063068c 100644 (file)
@@ -520,6 +520,10 @@ completions list."
             ;; hook update the completion preview in case the candidate
             ;; can be completed further.
             (when (functionp efn)
+              ;; Remove stale preview since `efn' can make arbitrary
+              ;; text and point modifications that might interfere with
+              ;; a subsequent preview update.  See bug#76606.
+              (completion-preview-active-mode -1)
               (funcall efn (concat base com) (if (cdr all) 'exact 'finished)))
           ;; Otherwise, remove the common prefix from the preview.
           (completion-preview--inhibit-update)